package com.xms.core.enums;

import java.io.Serializable;

public enum AccessRightValue implements Serializable {
    None(0, "none"),

    Read(1, "read"),

    Create(2, "create"),

    Update(3, "update"),

    Delete(4, "delete"),

    Share(5, "share"),

    Assign(6, "assign"),

    Append(7, "append"),

    AppendTo(8, "appendto"),

    Import(9, "import"),

    Export(10, "export");

    AccessRightValue(int value, String name) {
        this.value = value;
        this.name = name;
    }

    public boolean equals(AccessRightValue compared){
        return this.value() == compared.value();
    }

    public int value() {
        return value;
    }

    public String text() {
        return name;
    }

    public static String text(int value){
        for (AccessRightValue enumValue : AccessRightValue.values()){
            if(value == enumValue.value()){
                return enumValue.text();
            }
        }
        return null;
    }

    private int value;
    private String name;
}
